package iterator;


// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
// #[regen=yes,id=DCE.46457C8C-A712-040F-A606-5645CE8A1EB1]
// </editor-fold> 
public class CompteCorrent implements Iterator {

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.702B6472-58B3-78B4-07BC-2B1011DDFC50]
    // </editor-fold> 
    private int posicion;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.89B268C6-C659-0294-69EC-3CF9D68F2105]
    // </editor-fold> 
    private int index;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.140952CF-0BF2-2CB8-49A8-4032A2C657E1]
    // </editor-fold> 
    private String[] titulars;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.85B4E0D0-2A34-2112-AC62-8321CA7BF757]
    // </editor-fold> 
    public CompteCorrent () {
        titulars = new String[5];
//        titulars = new String[0];
        index = 0;
        posicion = 0;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.5538DB9D-FAAB-03D0-D61C-5E50115229E3]
    // </editor-fold> 
    public boolean hasNext () {
        // return (posicion<index);
        boolean surt = (posicion < index);
        if (!surt) {
            posicion = 0;
        }
        return surt;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.00CA48A6-AECF-585F-B5A2-709BFF3CF551]
    // </editor-fold> 
    public Object next () {
        // posicion++;
        // return titulars[posicion-1];
        return titulars[posicion++];
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.AD42D842-8B91-7231-DF9A-1594C383F8B2]
    // </editor-fold> 
    public String[] getTitulars () {
        return titulars;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.040CE294-8DB2-A603-E8CC-CB61F44B4EA1]
    // </editor-fold> 
    public void setTitulars (String[] val) {
        this.titulars = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.C2C83D70-5396-DA91-A372-B57A4639767F]
    // </editor-fold> 
    public void addTitular (String titular) {
        if (index < titulars.length) {
            titulars[index++] = titular;
        }

//        String[] l = new String[titulars.length + 1];
//        System.arraycopy(titulars, 0, l, 0, titulars.length);
//        l[titulars.length] = titular;
//        titulars = new String[l.length];
//        System.arraycopy(l, 0, titulars, 0, l.length);
//        titulars[index++] = titular;

    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.96BCB4F9-EF63-F1DE-9A4B-60D926802A78]
    // </editor-fold> 
    public int getIndex () {
        return index;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.33680962-B620-B76B-185F-559CF687957E]
    // </editor-fold> 
    public void setIndex (int val) {
        this.index = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.003AB255-9157-0828-4576-EAAC5BBF9589]
    // </editor-fold> 
    public int getPosicion () {
        return posicion;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.BAB16EAC-9848-68E7-E2DC-D0F44526BF47]
    // </editor-fold> 
    public void setPosicion (int val) {
        this.posicion = val;
    }
}

